#include <iostream>
using namespace std;

/*
    用C语言实现函数功能：找出一个整数数组中，第二大的数。
*/

int main()
{
    int A[10] = {3, 1, 2, 5, 8, 4, 9, 6, 12, 7};
    int SecondMax = A[0];
    int Max = A[0];
    for (int i = 0; i < 10; i++)
    {
        if (Max < A[i])
        {
            SecondMax = Max;
            Max = A[i];
        }
        if (SecondMax < A[i] && A[i] != Max)
        {
            SecondMax = A[i];
        }
    }
    cout << "Second Max is " << SecondMax << endl;
 

    return 0;
}